package com.xhq.tools.rsa;

/**
 * @author huiny
 * @since 2021/8/14 23:30
 */
public enum PaddingModelEnum {
    PKCS1_PADDING("PKCS1Padding"),
    OAEP_WITH_SHA1_AND_MGF1_PADDING("OAEPWithSHA-1ANDMGF1PADDING"),
    OAEP_WITH_SHA256_AND_MGF1_PADDING("OAEPWithSHA-256ANDMGF1PADDING"),
    OAEP_WITH_SHA512_AND_MGF1_PADDING("OAEPWithSHA-512ANDMGF1PADDING"),
    /**
     * not be supported now
     */
    OAEP_WITH_SHA1024_AND_MGF1_PADDING("OAEPWithSHA-1024ANDMGF1PADDING"),
    ;

    private final String value;
    public String getValue() {
        return value;
    }

    PaddingModelEnum(String v) {
        this.value = v;
    }

    public static PaddingModelEnum getItem(String code) {
        for (PaddingModelEnum item : values()) {
            if (item.getValue().equalsIgnoreCase(code)) {
                return item;
            }
        }
        return null;
    }
}
